﻿using System;
using System.Data.Common;
using System.Data.Entity.Infrastructure;
using System.Data.SqlClient;

using MVCBootstrap.EntityFramework;

using StackExchange.Profiling;
using StackExchange.Profiling.Data;

namespace MVCBootstrap.Profiling {

	public class ProfilerContext : MembershipDbContext {

		public ProfilerContext() : base() { }
		public ProfilerContext(String nameOrConnectionString) : base(nameOrConnectionString) { }
		public ProfilerContext(DbCompiledModel model) : base(model) { }
		public ProfilerContext(String nameOrConnectionString, DbCompiledModel model) : base(nameOrConnectionString, model) { }
		public ProfilerContext(DbConnection existingConnection, Boolean contextOwnsConnection) : base(existingConnection, contextOwnsConnection) { }
		public ProfilerContext(DbConnection exisingConnection, DbCompiledModel model, Boolean contextOwnsConnection) : base(exisingConnection, model, contextOwnsConnection) { }

		private static DbConnection GetConnection(String connectionString) {
			DbConnection connection = new SqlConnection(connectionString);
			return new EFProfiledDbConnection(connection, MiniProfiler.Current);
		}
	}
}